<template>
  <div>
    <el-card shadow="hover" class="box-card">
      <div slot="header" class="clearfix">
        <span>业务指导</span>
        <div class="btn">
          <el-button type="primary" @click="back">返回</el-button>
        </div>
      </div>
      <div>
        <el-tabs v-model="activeName" type="card" @tab-click="getList">
          <el-tab-pane label="坐席" name="3"></el-tab-pane>
        </el-tabs>
        <div class="form">
          <el-table :data="tableData" border stripe style="width: 100%">
            <el-table-column prop="fileName" label="文件名" align="center"> </el-table-column>
            <el-table-column prop="createTime" label="上传时间" align="center"> </el-table-column>
            <el-table-column fixed="right" label="操作" align="center">
              <template slot-scope="scope">
                <el-button @click="openFile(scope.row)" type="primary" size="small">打开手册</el-button>
              </template>
            </el-table-column>
          </el-table>
        </div>
      </div>
    </el-card>
  </div>
</template>

<script>
import * as api from '@/api/project'
import env from '@/utils/env'
export default {
  data() {
    return {
      activeName: '3',
      tableData: [],
      file: {
        fileName: '',
        fileLocation: '',
      },
      fullscreenLoading: false,
      fileList: [],
      upaction:
        process.env.NODE_ENV === 'production'
          ? env.prod.baseUrl
          : process.env.NODE_ENV === 'test'
          ? env.test.baseUrl
          : env.dev.baseUrl,
    }
  },
  created() {
    this.getList()
  },
  methods: {
    back() {
      this.$parent.Tip()
    },
    getList() {
      let data = {
        id: this.activeName,
      }
      api.fileList(data).then(res => {
        if (res.code == '200') {
          this.tableData = res.data
        }
      })
    },
    // 打开文件
    openFile(e) {
      window.open(e.fileLocation)
    },
  },
}
</script>

<style lang="scss" scoped>
.addBut {
  margin-bottom: 10px;
}
.btn {
  width: 70px;
  height: 41px;
  margin: auto;
  margin-right: 72px;
  margin-top: 10px;
}
</style>
